﻿using System;
using System.Collections.Generic;
//using System.Linq;
using System.Web;

namespace IntelligentCMS
{
    public class common
    {

        public static byte[] StrToByteArray(string str)
        {
            System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
            return encoding.GetBytes(str);
        }


        public static string GetBase64String(string s)
        {
            return Convert.ToBase64String(StrToByteArray(s));

        }

        public static string ByteToStrArray(byte[] str)
        {
            System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();

            return encoding.GetString(str);
        }

        public static string FromBase64String(string s)
        {
            return ByteToStrArray(Convert.FromBase64String(s));

        }


    }
}
